<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <title>Document</title>
  <style>
    :root {
      --border-color: conic-gradient(from 180deg at 50% 50%,
          #e92a67 0deg,
          #a853ba 112.5deg,
          #2a8af6 228.75deg,
          rgba(42, 138, 246, 0) 360deg);
      --border-radius: 12px;
      --border-size: 3px;
      --bg-color: #262626;
    }

    body {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 10px;
      padding: 20px;
    }

    .container {
      margin: 30vh auto;
      position: relative;
      width: 240px;
      height: 320px;
      border-radius: var(--border-radius);
      overflow: hidden;
      display: flex;
      align-items: center;
      justify-content: center;
      color: #fff;
      font-size: 40px;
      font-weight: 700;
    }

    .container::before {
      content: '';
      position: absolute;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%);
      display: block;
      width: 200%;
      padding-bottom: 200%;
      background: var(--border-color);
      animation: rotate 3s linear infinite;
      z-index: -1;
    }

    .container::after {
      content: '';
      position: absolute;
      inset: var(--border-size);
      background: var(--bg-color);
      border-radius: var(--border-radius);
      z-index: -1;
    }



    @keyframes rotate {
      from {
        transform: translate(-50%, -50%) rotate(0deg);
      }

      to {
        transform: translate(-50%, -50%) rotate(-360deg);
      }
    }

    .gradient-border1 {
      width: 200px;
      padding: 20px;
      border: 3px solid;
      border-image: linear-gradient(to bottom, #3d82ff, #ebdfff) 1;
      /* 可选：圆角 */
      border-radius: 10px;
      overflow: hidden;
    }

    .gradient-border {
      width: 200px;
      position: relative;
      background: linear-gradient(to bottom, #3d82ff, #ebdfff);
      padding: 4px;
      /* 控制边框宽度 */
      border-radius: 8px;
      /* 外层圆角 */
    }

    .gradient-border>.gradient-border-content {
      background: white;
      /* 内容背景色 */
      display: block;
      border-radius: 4px;
      /* 内层圆角 = 外层 - 边框宽 */
      padding: 16px;
    }

    .btn {
      position: relative;
      padding: 3px;
      background: linear-gradient(to bottom, #3d82ff, #ebdfff);
      border: none;
      border-radius: 8px;
      font-size: 16px;
      cursor: pointer;
    }

    .btn span {
      display: block;
      padding: 8px 24px;
      background: #fff;
      border-radius: 6px;
      /* 8px - 2px */
    }


    .gradient-border2 {
      position: relative;
      padding: 4px;
      /* 这里的padding就是边框的宽度 */
      background: linear-gradient(to bottom, #3d82ff, #ebdfff);
      /* 渐变色 */
      border-radius: 12px;
      /* 圆角半径 */
      display: inline-block;
      /* 或其他合适的display属性 */
    }

    .gradient-border2 .content {
      background-color: white;
      /* 内容区域的背景颜色 */
      padding: 20px;
      /* 内容区域的内边距 */
      border-radius: 8px;
      /* 确保内部圆角小于外部，以显示渐变边框 */
    }
  </style>
</head>

<body>
  <div class="container">CARD-1</div>
  <hr>
  <div class="gradient-border1">渐变边框</div>
  <hr>
  <div class="gradient-border">
    <div class="gradient-border-content">渐变边框</div>
  </div>
  <hr>
  <!-- 使用 -->
  <button class="btn"><span>Click Me</span></button>
  <div class="gradient-border2">
    <div class="content">这里是内容</div>
  </div>
</body>

</html>